#! /usr/bin/env python
# -*- coding: utf-8 -*-

from playwright.sync_api import Page

from common.base_page import BasePage
from common.logger import logger
from locators.majorHazardSourceSafety.safetyGuaranteeResponsibility.guaranteeResponsibilityRec.loc_rec import LocRec


class QueryRec(BasePage):

    def __init__(self, page: Page):
        super().__init__(page)
        self.switch_menu('重大危险源安全管理')
        self.switch_menu('重大危险源安全包保责任落实监督')
        self.switch_menu('包保责任制履职记录')

    def query_total_rec(self, company_name, object_name, unit_name):
        logger.info('开始包保责任制履职记录查询测试')
        logger.info('选择排查企业')
        self.select(LocRec.loc_company, company_name)
        logger.info('选择风险分析对象')
        self.select(LocRec.loc_object, object_name)
        logger.info('选择风险分析单元')
        self.select(LocRec.loc_unit, unit_name)
        self.click(LocRec.loc_query)

    def reset(self):
        """
        测试重置
        :return:
        """
        self.click(LocRec.loc_reset, exact=True)
